"use strict";
cc._RF.push(module, 'afb10WNz+tEsbqioj8utEDB', 'load');
// script/utlis/load.js

"use strict";

cc.Class({
  "extends": cc.Component,
  properties: {
    m_proMaxLen: {
      "default": 590,
      type: cc.Integer
    },
    m_progressImg: {
      "default": null,
      type: cc.Node
    },
    x_speed: {
      "default": 300,
      type: cc.Integer
    }
  },
  // LIFE-CYCLE CALLBACKS:
  onLoad: function onLoad() {
    // this.propertiesMaxLen = this.m_progressImg.width;
    this.m_progressIg = false;
  },
  setProgress: function setProgress(pro) {
    if (pro > 1 || pro < 0) {
      return;
    }

    var width = this.m_proMaxLen * pro;

    if (width < this.setWidth) {
      return;
    }

    this.setWidth = this.m_proMaxLen * pro;
    this.m_progressIg = true; //this.m_progressImg.width = setWidth;    
  },
  start: function start() {
    this.m_progressImg.width = 0;
  },
  update: function update(dt) {
    if (this.m_progressIg) {
      if (this.m_progressImg.width < this.setWidth) {
        this.m_progressImg.width += dt * this.x_speed;
      }

      if (this.m_progressImg.width >= this.setWidth) {
        this.m_progressImg.width = 592;
        this.m_progressIg = false;

        if (this.finishCallBack != null) {
          this.finishCallBack();
        }
      }
    }
  }
});

cc._RF.pop();